<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>菜鸟教程</title>
  </head>
  <body>
    <script type="text/javascript">
      document.write(
        "JavaScript的内置对象：<br/>1.Arguments <br/>2.Array<br/> 3.Boolean <br/>4.Math <br/>5.Date <br/>6.Error <br/>7.Function <br/>8.Number <br/>9.Object <br/>10.RegExp <br/>11.String"
      );

      const str = "abcdea";
      console.log(str.indexOf("c"));
      console.log(str.lastIndexOf("c"));

      console.log(str.indexOf("a"));
      console.log(str.lastIndexOf("a"));

      const name = "helloworld";
      console.log(name.indexOf("l"));
      console.log(name.indexOf("l", 2));

      console.log("search方法");
      const name2 = "helloworld";
      console.log(name2.search("wo"));

      const name3 = "helloworld";
      console.log(name2.includes("wo"));
      console.log(name2.includes("ld"));

      const str2 = "smyhvaevaesmyh";
      for (var i = 0; i < str2.length; i++) {
        if (str2.charAt(i) === "m") {
          console.log(i);
        }
      }
    </script>
  </body>
</html>
